/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.TSRunner;

/**
 *
 * @author pyin
 */
public class TSRunnerStateServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        String state = new Boolean(TSRunner.isRunning()).toString();
        if(state.equalsIgnoreCase("true")){
            out.print("<h3>Running</h3>\t<a href='#' onClick='stopTSRunner()'>stop</a>");
        }else{
            out.print("<h3>Stopped</h3>\t<a href='#' onClick='startTSRunner()'>start</a>");
        }
    }
}
